home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-08-02 | 2.0 KB | 83 lines | [TEXT/PJMM] |
- unit KeyBoard;
- interface
- const
- LeftCursor = $46;
- RightCursor = $42;
- UpCursor = $4D;
- DownCursor = $48;
- {now for the Mac SE and II keyboards}
- xLeftCursor = $7B;
- xRightCursor = $7C;
- xDownCursor = $7D;
- xUpCursor = $7E;
-
- ReturnKey = $24;
- EnterKey = $4C;
- TabKey = $30;
- HelpKey = $72;
-
- xKey = 7;
- cKey = 8;
- vKey = 9;
- dummyClearKey = $FFFF;
- dummyOptionPasteKey = $FFFE;
- type
- CursorType = (noCurs, LeftCurs, RightCurs, UpCurs, DownCurs, TabCurs, Carriage);
-
- function whichCursor (keyCode: byte): CursorType;
- {The following were gratefully taken from Warren P. Michelsen}
- {MacTutor, May 1988, page 9}
- function SpaceKeyDown: boolean;
- function PeriodKeyDown: boolean;
- function CommandKeyDown: boolean;
- function OptionKeyDown: boolean;
- implementation
- {**************************************************}
- function TestKey (i: longint): boolean;
- var
- myKeys: keyMap;
- begin
- GetKeys(myKeys);
- TestKey := BitTst(@myKeys[1], i)
- end;
- {**************************************************}
- function SpaceKeyDown: boolean;
- begin
- SpaceKeyDown := TestKey(22);
- end;
- {**************************************************}
- function whichCursor (keyCode: byte): CursorType;
- begin
- case KeyCode of
- LeftCursor, xLeftCursor:
- whichCursor := leftCurs;
- RightCursor, xRightCursor:
- whichCursor := RightCurs;
- DownCursor, xDownCursor:
- whichCursor := DownCurs;
- UpCursor, xUpCursor:
- whichCursor := UpCurs;
- TabKey:
- whichCursor := TabCurs;
- ReturnKey:
- whichCursor := Carriage;
- otherwise
- whichCursor := noCurs;
- end;{case}
- end;
- {**************************************************}
- function PeriodKeyDown: boolean;
- begin
- PeriodKeyDown := TestKey(8);
- end;
- {**************************************************}
- function OptionKeyDown: boolean;
- begin
- OptionKeyDown := TestKey(29);
- end;
- {**************************************************}
- function CommandKeyDown: boolean;
- begin
- CommandKeyDown := TestKey(16);
- end;
- end.